package com.test.executor;

/**
 * Created by jl on 2018/8/14 0014
 */
public class ForCpuCalc {

        public boolean isPrime(final int number){
            if(number <= 1) return false;

            for(int i = 2; i <=Math.sqrt(number); i++){
                if (number % i == 0)
                    return false;
            }
            return true;
        }

        public int countPrimesInRange(final int lower, final int upper){
            int total = 0;
            for( int i = lower; i <= upper; i++){
                if(isPrime(i))
                    total++;
            }
            return total;
        }
}
